<%@page import="java.time.LocalDateTime"%>
<%@page import="java.util.Date"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

	<head>
		<base href="<%=request.getContextPath()%>/">
		<title></title>
		<link rel="stylesheet" type="text/css" href="Styles/bootstrap.min.css" />
		<link rel="stylesheet" type="text/css" href="Styles/admin-all.css" />
		<script type="text/javascript" src="Scripts/jquery-1.7.2.js"></script>
		<script type="text/javascript" src="Scripts/jquery-ui-1.8.22.custom.min.js"></script>
		<link rel="stylesheet" type="text/css" href="Styles/ui-lightness/jquery-ui-1.8.22.custom.css" />
		<script type="text/javascript" src="Scripts/tip.js"></script>
	</head>

	<body>
	
	<%
		pageContext.setAttribute("month", LocalDateTime.now().getMonthValue());
	%>
	
		<div class="alert alert-info">当前位置<b class="tip"></b>绩效管理<b class="tip"></b>民主测评</div>
		<h3 style='text-align:center;'>第<span id='span_1'>${month }</span>月份匿名投票</h3>
		<c:if test="${not empty msg }">
			<h2 style="text-align:center">${msg }</h2>
		</c:if>
		<c:if test="${empty msg }">
		<div id="div-1">
		<table class="table table-striped table-bordered table-condensed">
			<thead>
				<tr>
					<td class="auto-style2">&nbsp;员工姓名 </td>
					<td class="auto-style2">&nbsp;得分（满分10分） </td>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${listNames }" var="name">
					<tr>
						<td><span name='name'>${name.empName }</span></td>
						<td><input type="text" name='score' /></td>
					</tr>
				</c:forEach>
				<tr >
				<td colspan="2"><input type="button" value='提交' onclick="submit();"></td>
				</tr>
			</tbody>
		</table></div></c:if>
		<h2 id="h_1" style="text-align:center"></h2>
	</body>
</html>
<script type="text/javascript">
	function submit(){
		var aa=document.getElementsByName("name");
		var bb=document.getElementsByName("score");
		var cc=document.getElementById("span_1");
		var dd='${number }';
		var names='';
		var scores='';
		for(var i=0;i<aa.length;i++){
			names+=aa[i].innerText+',';
			scores+=bb[i].value+',';
		}
		$.post("assess/add",{
			name:names,
			score:scores,
			month:cc.innerText,
			number:dd
		},function(data){
			if(data>0){
				$("#div-1").hide();
				$("#h_1").text("谢谢您的参与！")
			}
		})		
	}

</script>
